//
//  BaseModel.m
//  豆瓣电影
//
//  Created by panxue on 15/12/25.
//  Copyright © 2015年 panxue. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel
//初始化
- (instancetype)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

//遍历构造器
+ (instancetype)modelWithDic:(NSDictionary *)dic
{
    id m = [[[self class] alloc] initWithDic:dic];
    return m;
}

//数组+字典-->数组+对象
+ (NSMutableArray *)modelHanderWithArray:(NSArray *)arr
{
    NSMutableArray *mArr = [NSMutableArray array];
    for (NSDictionary *dic in arr) {
        id m = [[self class] modelWithDic:dic];
        [mArr addObject:m];
    }
    return mArr;
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

@end
